package com.sugon.entity;

import cn.hutool.core.util.EnumUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sugon.modules.sparepart.consts.SparePartTransactionTypeEnum;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 备件事务记录实体
 * 表名 SPARE_PART_TRANSACTION_RECORD
 *
 * @author YuXD
 * @date 2022-09-05
 */
@Data
public class SparePartTransactionRecordEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date gmtCreate;
    /**
     * 业务ID，一般为单据ID
     */
    private String busId;
    /**
     * 事务描述
     */
    private String transactionDesc;
    /**
     * 操作日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date operateDate;
    /**
     * 操作员
     */
    private String operator;
    /**
     * 数量
     */
    private Integer quantity;
    /**
     * 备件ID
     */
    private String sparePartId;
    /**
     * 业务单号
     */
    private String busOrderNo;
    /**
     * 事务类别
     */
    private String transactionType;
    /**
     * 主键
     */
    private String id;

    /**
     * 关联货位ID
     */
    private String cargoLocation;

    /********************VO字段**********************/

    /**
     * 操作员
     */
    private String operatorName;

    /**
     * 事务类别
     */
    private String transactionTypeName;

    public String getTransactionTypeName() {
        return EnumUtil.fromString(SparePartTransactionTypeEnum.class, getTransactionType()).getDesc();
    }
}
